package com.mrjy.live.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.WisConsultInfo;
import com.mrjy.common.entity.UserInfo;
import com.mrjy.common.util.GlobalConstant;
import com.mrjy.live.bo.IWisConsultInfoBo;

@Controller
@RequestMapping("/live/wisConsultInfo")
public class WisConsultInfoController{
	@Resource
	private IWisConsultInfoBo wisConsultInfoBo;
	

	/**
	 * 显示信息
	 * @return
	 */
	@RequestMapping("/wisConsultInfoList")
	@ResponseBody
	public Object WisConsultInfoList(WisConsultInfo wisConsultInfo,HttpSession session) {
		UserInfo userInfo = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO));
		return wisConsultInfoBo.queryPageWisConsultInfo(wisConsultInfo,userInfo);
	}
	/**
	 * 添加
	 * @return
	 */
	@RequestMapping("/addWisConsultInfo")
	@ResponseBody
	public Object insert(WisConsultInfo wisConsultInfo,HttpSession session){
		UserInfo userInfo = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO));
		wisConsultInfo.setUserId(userInfo.getId());		
		//wisConsultInfo.setMobilePhone(userInfo.getMobilePhone());
		wisConsultInfoBo.insert(wisConsultInfo);
		return "ok";
	}
	/**
	 * 根据ID查询
	 * @return
	 */
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int id) {
		return wisConsultInfoBo.queryById(id);
	}
	/**
	 * 修改
	 * @param userNews
	 * @return
	 */
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(WisConsultInfo wisConsultInfo,HttpSession session) {
		UserInfo userInfo = ((UserInfo) session.getAttribute(GlobalConstant.USER_INFO));
		wisConsultInfo.setUserId(userInfo.getId());
		wisConsultInfoBo.updateById(wisConsultInfo);
		return "ok";
	}
	
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return wisConsultInfoBo.deleteByIds(ids);
	}
	/**
	 * 禁用、起用
	 * @param ids
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(WisConsultInfo wisConsultInfo) {		
		return wisConsultInfoBo.updateDisableFlag(wisConsultInfo);
	}
}
